import axios from '@/libs/axios1'
let headers = {'content-type': 'application/json;charset=UTF-8'}

/**
 * 创建事件
 * @param {*} data 
 * @returns 
 */
export const createEvent = data =>{
    return axios({
        url:`/typical-event/typicalEvent`,
        method:'post',
        headers,
        data
    })
}

/**
 * 删除事件
 * @param {*} id 
 * @returns 
 */
export const deleteEvent = id =>{
    return axios({
        url:`/typical-event/typicalEvent/${id}`,
        method:'delete',
        headers
    })
}

/**
 * 查询事件列表
 * @param {*} params 
 * @returns 
 */
export const getEventlist = params =>{
    return axios({
        url:`/typical-event/typicalEvent`,
        method:'get',
        headers,
        params
    })
}

/**
 * 修改事件
 * @param {*} data 
 * @returns 
 */
export const updateEvent = data =>{
    return axios({
        url:`/typical-event/typicalEvent`,
        method:'put',
        headers,
        data
    })
}
/**
 * 绑定事件工程
 * @param {*} data 
 * @returns 
 */
 export const eventBindProject = (id,projectId) =>{
    return axios({
        url:`/typical-event/typicalEvent/bind/${id}/${projectId}`,
        method:'put',
        headers,
    })
}

/**
 * 查询事件列表
 * @param {*} params 
 * @returns 
 */
 export const getEventReferencelist = params =>{
    return axios({
        url:`/typical-event/eventQuoteLink`,
        method:'get',
        headers,
        params
    })
}

/**
 * 创建事件文档
 * @param {*} data 
 * @returns 
 */
 export const addEventDocument = data =>{
    return axios({
        url:`/typical-event/eventScheme`,
        method:'post',
        headers,
        data
    })
}

/**
 * 删除事件文档
 * @param {*} ids 指定删除的ids
 * @returns 
 */
export const deleteEventDocument = ids =>{
    return axios({
        url:`/typical-event/eventScheme`,
        method:'delete',
        headers,
        data: ids
    })
}

/**
 * 查询事件文档列表
 * @param {*} params 
 * @returns 
 */
export const getEventDocumentlist = params =>{
    return axios({
        url:`/typical-event/eventScheme`,
        method:'get',
        headers,
        params
    })
}

/**
 * 修改事件文档
 * @param {*} data 
 * @returns 
 */
export const updateEventDocument = data =>{
    return axios({
        url:`/typical-event/eventScheme`,
        method:'put',
        headers,
        data
    })
}

/**
 * 创建事件工程
 * @param {*} data 
 * @returns 
 */
 export const addEventProject = data =>{
    return axios({
        url:`/typical-event/eventPrjTmpl`,
        method:'post',
        headers,
        data
    })
}

/**
 * 删除事件工程
 * @param {*} id 指定删除的id
 * @returns 
 */
export const deleteEventProject = id =>{
    return axios({
        url:`/typical-event/eventPrjTmpl/${id}`,
        method:'delete',
        headers,
    })
}

/**
 * 查询事件工程列表
 * @param {*} params 
 * @returns 
 */
export const getEventProjectlist = params =>{
    return axios({
        url:`/typical-event/eventPrjTmpl`,
        method:'get',
        headers,
        params
    })
}

/**
 * 修改事件工程
 * @param {*} data 
 * @returns 
 */
export const updateEventProject = data =>{
    return axios({
        url:`/typical-event/eventPrjTmpl`,
        method:'put',
        headers,
        data
    })
}

/**
 * 创建事件工具
 * @param {*} data 
 * @returns 
 */
 export const addEventTool = data =>{
    return axios({
        url:`/typical-event/eventTool`,
        method:'post',
        headers,
        data
    })
}

/**
 * 删除事件工具
 * @param {*} id 指定删除的id
 * @returns 
 */
export const deleteEventTool = ids =>{
    return axios({
        url:`/typical-event/eventTool`,
        method:'delete',
        headers,
        data: ids
    })
}

/**
 * 查询事件工具列表
 * @param {*} params 
 * @returns 
 */
export const getEventToollist = params =>{
    return axios({
        url:`/typical-event/eventTool`,
        method:'get',
        headers,
        params
    })
}

/**
 * 修改事件工具
 * @param {*} data 
 * @returns 
 */
export const updateEventTool = data =>{
    return axios({
        url:`/typical-event/eventTool`,
        method:'put',
        headers,
        data
    })
}

/**
 * 查询已有的工具
 * @param {*} params 
 * @returns 
 */
export const getAlreadyToollist = params => {
    return axios({
        url:`/tools/tools/list`,
        method:'get',
        headers,
        params
    })
}

export const downloads = params => {
    return axios({
        method: 'post',
        url: `/checker/scripts/download`,
        data: params,
        headers
    })
}

/**
 * 创建案例复盘
 * @param {*} data 
 * @returns 
 */
 export const createCaseAnalyse = data =>{
    return axios({
        url:`/typical-event/caseAnalyse`,
        method:'post',
        headers,
        data
    })
}

/**
 * 删除案例复盘
 * @param {*} id 
 * @returns 
 */
export const deleteCaseAnalyse = id =>{
    return axios({
        url:`/typical-event/caseAnalyse/${id}`,
        method:'delete',
        headers
    })
}

/**
 * 查询案例复盘列表
 * @param {*} params 
 * @returns 
 */
 export const getCaseAnalyseList = params =>{
    return axios({
        url:`/typical-event/caseAnalyse`,
        method:'get',
        headers,
        params
    })
}

/**
 * 查询案例复盘详情
 * @param {*} params 
 * @returns 
 */
 export const getCaseAnalyseDetail= id =>{
    return axios({
        url:`/typical-event/caseAnalyse/${id}`,
        method:'get',
        headers
    })
}

/**
 * 修改案例复盘
 * @param {*} data 
 * @returns 
 */
export const updateCaseAnalyse = data =>{
    return axios({
        url:`/typical-event/caseAnalyse/${data.id}`,
        method:'put',
        headers,
        data
    })
}

/**
 * 删除替换镜像记录
 * @param {*} data 
 * @returns 
 */
export const delCreateImage = (data) => {
    return axios({
        url: `/quickexp/replaceImage/del`,
        method: 'delete',
        data: data,
        headers
    });
};

/**
 * 查询替换镜像记录列表
 * @param {*} params 
 * @returns 
 */
export const getCreateImageList = (params) => {
    return axios({
        url: `/quickexp/replaceImage/page`,
        method: 'get',
        params: params,
        headers
    });
};

/**
 * 执行替换镜像并生成模板
 * @param {*} params 
 * @returns 
 */
export const repAndCreateTemplate = (params) => {
    return axios({
        url: `/quickexp/replaceImage/repAndCreateCase/`,
        method: 'post',
        data: params,
        headers
    });
};

/**
 * 替换模板记录
 * @param {*} params 
 * @returns 
 */
export const getRepTemplateList = (params) => {
    return axios({
        url: `/quickexp/replaceTempl/page`,
        method: 'get',
        params: params,
        headers
    });
};

/**
 * 清空部署
 * @param {*} id 
 * @param {*} data 
 * @returns 
 */
export const clearDeloyPro = (id, data) => {
    return axios({
        url: `/topo-edit/project/clear/${id}`,
        method: 'post',
        data: JSON.stringify(data),
        headers
    });
};

/**
 * 绑定文件与案例关系
 * @param {*} data 
 * @returns 
 */
 export const bindFile = data => {
    return axios({
        url:`/typical-event/caseRelation`,
        method:'post',
        headers,
        data
    })
}

/**
 * 解绑文件与案例关系
 * @param {*} data 
 * @returns 
 */
export const unbindFile = id => {
    return axios({
        url:`/typical-event/caseRelation/${id}`,
        method:'delete',
        headers
    })
}

/**
 * 发布/取消发布
 * @param {*} id
 * @param {*} checkStatus
 * @returns 
 */
export const  changeCasePublishStatus = (id,checkStatus) => {
    return axios({
        url:`/typical-event/caseAnalyse/check/${id}/${checkStatus}`,
        method:'put',
        headers
    })
}